/**
 * Created by dqw on 2015/12/30.
 */
//列表开始
var dtGridColumns = [
    {
        id: 'status',
        type: 'int',
        hideQuery:true,
        hideQueryType:'eq',
        hideQueryValue:3,
        hide:true

    },
    {
        id: 'userId',
        title: '用户ID',
        type: 'string',
        columnClass: 'text-center width-100',
        fastSort: true
    },
    {
        id: 'u.userName',
        title: '用户姓名',
        type: 'string',
        columnClass: 'text-center width-100',
        fastSort: false,
        fastQuery: true,
        fastQueryType: 'lk'
    },
    {
        id: 'u.mobilePhone',
        title: '用户手机号码',
        type: 'string',
        columnClass: 'text-center width-100',
        fastSort: false,
        fastQuery: true,
        fastQueryType: 'lk'
    },
    {
        id: 'lessDiyan',
        title: '递延费不足(元)',
        type: 'number',
        columnClass: 'text-center width-100',
        fastSort: false,
        format:'#,##0.00'
    }
];

var dtGridOption = {
    lang: 'zh-cn',
    ajaxLoad: true,
    loadURL: ncGlobal.adminRoot + 'diyan/list.json',
    exportFileName: '递延不足列表',
    columns: dtGridColumns,
    gridContainer: 'dtGridContainer',
    toolbarContainer: 'dtGridToolBarContainer',
    pageSize: 10,
    pageSizeLimit: [10, 20, 50],
    ncColumnsType: {int:["id","userId"],BigDecimal:["lessDiyan"]}
};

var grid = $.fn.DtGrid.init(dtGridOption);
grid.fastQueryParameters = new Object();
grid.fastQueryParameters['eq_status'] = 3;
//排序
grid.sortParameter.columnId = 'id';
grid.sortParameter.sortType = 0;
//列表结束

//操作处理开始
var OperateHandle = function () {

    function _bindEvent() {

        //模糊搜索
        $('#customSearch').click(function () {
            grid.fastQueryParameters = new Object();
            grid.fastQueryParameters['lk_user_name'] = $('#keyword').val();
            grid.fastQueryParameters['eq_status'] = 3;
            grid.pager.startRecord = 0;
            grid.pager.nowPage = 1;
            grid.pager.recordCount = -1;
            grid.pager.pageCount = -1;
            grid.refresh(true);
        });
    }

    //外部可调用
    return {
        bindEvent: _bindEvent,
    }
}();
//操作处理结束

$(function () {
    //加载列表
    grid.load();
    //页面绑定事件
    OperateHandle.bindEvent();
});